//
//  Variable.hpp
//  
//
//  Created by François Reme on 12/10/12.
//  Copyright 2012 KingTao. All rights reserved.
//

#ifndef _Argument_hpp
#define _Argument_hpp

#include "Categorie.hpp"
#include "../type/Type.hpp"
#include "../type/TypeInteger.hpp"
#include "../type/TypeString.hpp"
#include "../type/TypeBool.hpp"
#include "../type/TypeChar.hpp"
#include "../type/TypeReal.hpp"

using std::string;
using std::cout;
using std::endl;

class Argument : public Categorie{

	public:

		Argument(){
        mType = NULL;
        TYPE = Categorie::ARGUMENT;
    }
    Argument(int arg_type){
        setType(arg_type);
        TYPE = Categorie::ARGUMENT;
    }
    ~Argument(){
        
    }

void initType(){
        if(mType != NULL){
            delete mType;
        }
    }

void setType(int t){
        //initType();
        switch (t) {
            case Type::TYPE_INTEGER:
                this->mType = new TypeInteger();
                break;
            case Type::TYPE_REAL:
                this->mType = new TypeReal();
                break;
            case Type::TYPE_BOOL:
                this->mType = new TypeBool();
                break;
            case Type::TYPE_STRING:
                this->mType = new TypeString();
                break;
            case Type::TYPE_CHAR:
                this->mType = new TypeChar();
                break;
            default:
                break;
        }
}

void printLine(){
   cout << "Argument ";
    
	cout << "type : ";
    if(mType != NULL){
        if(mType->CODE_TYPE == Type::TYPE_INTEGER){
            cout << "integer";
        }else if(mType->CODE_TYPE == Type::TYPE_REAL ){
            cout << "real";
        }else if(mType->CODE_TYPE == Type::TYPE_STRING ){
            cout << "string";
        }else if(mType->CODE_TYPE == Type::TYPE_CHAR ){
            cout << "char";
        }else if(mType->CODE_TYPE == Type::TYPE_BOOL ){
            cout << "boolean";
        }else{
            cout << "default type";
        }
    }else{
        cout << "NULL";
    }
    cout << endl;
}

	private:
    		Type * mType;
};

#endif
